package com.test.java;

import java.util.Scanner;

/**
 * 本题要求读入N名学生的成绩，将获得某一给定分数的学生人数输出。
 * =============================================================
 * Version          Author          Date            Description
 * 1.0              白建         2017/12/29             创建
 * =============================================================
 */
public class Java_29
{

    public static void main(String[] args)
    {

        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();

        int[] input = new int[N];
        for (int i = 0; i < N; i++)
        {
            input[i] = scanner.nextInt();
        }

        int M = scanner.nextInt();
        int[][] search = new int[M][2];
        for (int i = 0; i < M; i++)
        {
            search[i][0] = scanner.nextInt();
        }
        for (int i = 0; i < M; i++)
        {
            for (int j = 0; j < N; j++)
            {
                if (input[j] == search[i][0])
                {
                    search[i][1]++;
                }
            }
        }
        int i;
        for (i = 0; i < (M - 1); i++)
        {
            System.out.print(search[i][1] + " ");
        }
        System.out.print(search[i][1]);
    }
}
